﻿using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using HumanManagement.BusinessObjects;
using HumanManagement.DataAccess;

namespace HumanManagement.BusinessLogic
{
	public class LeaderPositionAppointmentBL
	{

		#region ***** Init Methods ***** 
		LeaderPositionAppointmentDA objLeaderPositionAppointmentDA;
		public LeaderPositionAppointmentBL()
		{
			objLeaderPositionAppointmentDA = new LeaderPositionAppointmentDA();
		}
		#endregion

		#region ***** Get Methods ***** 
		/// <summary>
		/// Get LeaderPositionAppointment by id
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns>LeaderPositionAppointment</returns>
		public LeaderPositionAppointment GetByID(int id, int PersonalProfileID)
		{
            return objLeaderPositionAppointmentDA.GetByID(id, PersonalProfileID);
		}

		/// <summary>
		/// Get all of LeaderPositionAppointment
		/// </summary>
		/// <returns>List<<LeaderPositionAppointment>></returns>
		public List<LeaderPositionAppointment> GetList()
		{
			string cacheName = "lstLeaderPositionAppointment";
			if( ServerCache.Get(cacheName) == null )
			{
				ServerCache.Insert(cacheName, objLeaderPositionAppointmentDA.GetList(), "LeaderPositionAppointment");
			}
			return (List<LeaderPositionAppointment>) ServerCache.Get(cacheName);
		}

		/// <summary>
		/// Get DataSet of LeaderPositionAppointment
		/// </summary>
		/// <returns>DataSet</returns>
        public DataSet GetDataSet(int PersonalProfileID)
		{
			string cacheName = "dsLeaderPositionAppointment";
            ServerCache.Remove("dsLeaderPositionAppointment");
			if( ServerCache.Get(cacheName) == null )
			{
                ServerCache.Insert(cacheName, objLeaderPositionAppointmentDA.GetDataSet(PersonalProfileID), "LeaderPositionAppointment");
			}
			return (DataSet) ServerCache.Get(cacheName);
		}


		/// <summary>
		/// Get all of LeaderPositionAppointment paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>List<<LeaderPositionAppointment>></returns>
		public List<LeaderPositionAppointment> GetListPaged(int recperpage, int pageindex)
		{
			return objLeaderPositionAppointmentDA.GetListPaged(recperpage, pageindex);
		}

		/// <summary>
		/// Get DataSet of LeaderPositionAppointment paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>DataSet</returns>
		public DataSet GetDataSetPaged(int recperpage, int pageindex)
		{
			return objLeaderPositionAppointmentDA.GetDataSetPaged(recperpage, pageindex);
		}





		#endregion

		#region ***** Add Update Delete Methods ***** 
		/// <summary>
		/// Add a new LeaderPositionAppointment within LeaderPositionAppointment database table
		/// </summary>
		/// <param name="obj_leaderpositionappointment">LeaderPositionAppointment</param>
		/// <returns>key of table</returns>
		public int Add(LeaderPositionAppointment obj_leaderpositionappointment)
		{
			ServerCache.Remove("LeaderPositionAppointment", true);
			return objLeaderPositionAppointmentDA.Add(obj_leaderpositionappointment);
		}

		/// <summary>
		/// updates the specified LeaderPositionAppointment
		/// </summary>
		/// <param name="obj_leaderpositionappointment">LeaderPositionAppointment</param>
		/// <returns></returns>
		public void Update(LeaderPositionAppointment obj_leaderpositionappointment)
		{
			ServerCache.Remove("LeaderPositionAppointment", true);
			objLeaderPositionAppointmentDA.Update(obj_leaderpositionappointment);
		}

		/// <summary>
		/// Delete the specified LeaderPositionAppointment
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns></returns>
		public void Delete(int id)
		{
			ServerCache.Remove("LeaderPositionAppointment", true);
			objLeaderPositionAppointmentDA.Delete(id);
		}
		#endregion
	}
}
